Sieve_Cache
lock_free.Sieve_Cache
Sieve_Cache(K:property.hashable,V:Any,MM:container.Mutable_Map K (lock_free.Node K V),capacity i64) ref:Any is¶[src]
Type Parameters
Fields
Functions
access(key K,val Function V) => V¶[src]
access stored value for key,
if not in cache, compute and store in cache
if not in cache, compute and store in cache
as_string => String[Redefinition of Any.as_string]¶[src]
Comment of Any.as_string
create a String from this instance. Unless redefined, `a.as_string` willcreate `"instance[T]"` where `T` is the dynamic type of `a`
0.099dev (GIT hash e2d5298d8107bb5fe79600fdb06a49bc75756344)
It achieves both simplicity and efficiency."
source: https://sievecache.com/
paper : https://junchengyang.com/publication/nsdi24-SIEVE.pdf
example usage:
cache0 := lock_free.Sieve_Cache String i32 3
say <| cache0.access "A" ()->1 # => 1
say <| cache0.access "B" ()->2 # => 2
say <| cache0.access "C" ()->3 # => 3
say <| cache0.access "A" ()->4 # => 1
say <| cache0.access "D" ()->5 # => 5
say <| cache0.access "C" ()->6 # => 3